package com.hanter.android.radui.dialog;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import com.hanter.android.radui.R;


public class LoadingDialog extends MyDialogFragment {

    public static LoadingDialog newInstance() {
        LoadingDialog fragment = new LoadingDialog();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        fragment.setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme_Dialog_LoadingDialog);
        return fragment;
    }

    @Override
    public void onStart() {
        super.onStart();

        if (getDialog() != null && getDialog().getWindow() != null) {
            Window window = getDialog().getWindow();
            int size = getResources().getDimensionPixelSize(R.dimen.rad_loading_dialog_size);
            window.setLayout(size, size);
        }
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.dialog_loading, container, false);
        initViews();
        return rootView;
    }

    private void initViews() {

    }

}
